package com.tywj.lib.net.retrofit.model

import io.reactivex.Observable
import okhttp3.RequestBody
import okhttp3.ResponseBody
import retrofit2.Response
import retrofit2.http.*

/**
 * <pre>
 *     author : June Yang
 *     time   : 2020/5/8
 *     desc   : http请求方法
 *     version: 1.0.0
 * </pre>
 */
interface HttpMethod {

    @Streaming
    @GET
    fun get(
        @Url url: String,
        @HeaderMap headers: Map<String, String>,
        @QueryMap params: Map<String, String>
    ): Observable<Response<ResponseBody>>


    @Streaming
    @POST
    fun post(
        @Url url: String,
        @HeaderMap headers: Map<String, String>,
        @Body body: ProgressRequestBody
    ): Observable<Response<ResponseBody>>

    @PUT
    fun put(
        @Url url: String,
        @HeaderMap headers: Map<String, String>,
        @Body body: RequestBody
    ): Observable<Response<ResponseBody>>

    @DELETE
    fun delete(
        @Url url: String,
        @HeaderMap headers: Map<String, String>,
        @QueryMap params: Map<String, String>
    ): Observable<Response<ResponseBody>>

    @HTTP(method = "HEAD", hasBody = false)
    fun head(
        @Url url: String,
        @HeaderMap headers: Map<String, String>,
        @QueryMap params: Map<String, String>
    ): Observable<Response<ResponseBody>>

    @FormUrlEncoded
    @HTTP(method = "OPTIONS", hasBody = true)
    fun options(
        @Url url: String,
        @HeaderMap headers: Map<String, String>,
        @FieldMap params: Map<String, String>
    ): Observable<Response<ResponseBody>>

    @FormUrlEncoded
    @PATCH
    fun patch(
        @Url url: String,
        @HeaderMap headers: Map<String, String>,
        @FieldMap params: Map<String, String>
    ): Observable<Response<ResponseBody>>

}